<!DOCTYPE html>
<html
  layout:decorator="components/layout"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
>
<head>
  <title>机架管理</title>
</head>
<body>
<div
  layout:fragment="content"
  id="app" v-cloak
>
  <div class="container">
    <div class="myHeader">
      <div class="myHeader-title">
        机房机架管理
      </div>
      <div class="myHeader-tool">
        <el-button
          type="primary"
          size="mini"
          @click="_forward('/basic-data/admin_servers')"
          v-realm="'basic-data:base-server-info'"
        >服务器管理
        </el-button>

        <el-button
          @click="_forward('/basic-data/add/admin_frameinfo_add')"
          type="primary"
          size="mini"
          v-realm="'basic-data:base-frame-info:edit'"
        >新增机架</el-button>

        <el-button type="primary" icon="el-icon-search" size="mini" @click="toggle">高级搜索</el-button>

        &nbsp;
        所在机房:
        <el-select v-model="form.houseId" @change="searchPage" placeholder="请选择" size="mini" clearable>
          <el-option v-for="house in houses" :key="house.id" :label="house.houseName" :value="house.id">
          </el-option>
        </el-select>
      </div>
    </div>

    <el-row>
      <el-form label-width="100px" class="container-search" v-show="formShow">
        <el-row :gutter="10">
          <el-col :span="9">
            <el-form-item label="机架名称:">
              <el-input
                v-model="form.frameName"
                clearable
                show-word-limit
                maxlength="128"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="3">
            <el-form-item label-width="0">
              <rx-search-action
                v-model="form.frameNameAction"
              ></rx-search-action>
            </el-form-item>
          </el-col>
        </el-row>

        <div style="text-align:center; margin-bottom:20px">
          <el-button type="primary" size="medium" @click="searchPage">查 找</el-button>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <el-button type="primary" size="medium" @click="resetPage">重 置</el-button>
        </div>
      </el-form>
    </el-row>

    <!--内容-->
    <my-table
      :data="page.records"
      :columns="columns"
      @handle-selection-change="selection"
      @handle-sort-change="sortChange"
    >
      <template #operating="row">
        <el-button
          type="primary"
          size="mini"
          @click.stop.prevent="forwardUpdate(row.row)"
          v-realm="'basic-data:base-frame-info:edit'"
        >修改</el-button>
      </template>
    </my-table>
    <div class="pagination">
      <el-pagination
        background
        @size-change="changeSize"
        @current-change="goto"
        :current-page="page.current"
        :page-sizes="[10, 20, 30]"
        :page-size="page.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total"
      >
      </el-pagination>
      <div class="pagination-tool">
        <el-button
          type="primary"
          size="mini"
          @click="showFileSelector"
          v-realm="'basic-data:base-frame-info:edit'"
        >导入</el-button>
        <el-button
          type="primary"
          size="mini"
          @click="exportFile"
          v-realm="'basic-data:base-frame-info'"
        >导出</el-button>
        <el-button
          type="danger"
          size="mini"
          @click="deleteSelected"
          v-realm="'basic-data:base-frame-info:edit'"
        >删除</el-button>
      </div>
    </div>
    <import-excel
      title="导入机架信息"
      :file-selector-show="fileSelectorShow"
      @import-file="importFile"
      @reset-file="resetFile"
      @download-template="downloadTemplate"
    ></import-excel>
  </div>
</div>
<div layout:fragment="js">
  <script src="/static/js/module/basic-data/api/baseHouseInfoApi.js"></script>
  <script src="/static/js/module/basic-data/api/baseFrameInfoApi.js"></script>
  <script src="/static/js/module/basic-data/admin_frame_info.js"></script>
</div>
</body>
</html>
